// Fill out your copyright notice in the Description page of Project Settings.


#include "MyAnimInstance.h"
#include "GameFramework\Pawn.h"
#include "MyCharacter.h"
#include "GameFramework\PawnMovementComponent.h"

void UMyAnimInstance::NativeInitializeAnimation() 
{
	if (!Pawn) 
	{
		Pawn = TryGetPawnOwner();
	}
	Player = Cast<AMyCharacter>(Pawn);
}

void UMyAnimInstance::UpdateAnimationProperties() 
{
	if (!Pawn) 
	{
		Pawn = TryGetPawnOwner();
	}
	else 
	{
		FVector Speed = Pawn->GetVelocity();
		FVector LaterialSpeed = FVector(Speed.X, Speed.Y, 0);
		MoveSpeed = LaterialSpeed.Size();
		IsFalling = Pawn->GetMovementComponent()->IsFalling();
	}
}
